package controller

import (
	"tech-service/internal/service"

	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
)

type UserController struct {
	DB          *gorm.DB
	UserService *service.UserService
}

func NewUserController(db *gorm.DB) *UserController {

	return &UserController{
		DB:          db,
		UserService: service.NewUserService(db),
	}
}

func (c *UserController) Index(ctx *gin.Context) {

	users, err := c.UserService.GetUserList()
	if err != nil {
		ctx.JSON(500, gin.H{
			"data":    users,
			"message": err.Error(),
		})
		return
	}
}
